/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.vce.web.controller;

import com.vce.election.domain.BallotCentre;
import com.vce.election.domain.Town;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * @author Ggutierrez
 * @date 04-Oct-2012
 */
@Controller
@RequestMapping(value = "/election-counting")
public class ElectionController extends AbstractConfiguradorController{
    private static Logger log = LoggerFactory.getLogger(ElectionController.class);

    @Override
    protected Logger getLogger() {
        return log;
    }
    
    @RequestMapping("/ballot-town")
    @ResponseBody
    public List<BallotCentre> findBallotCentre(Long townId){
        Town town = manager.getTown(townId);
        List<BallotCentre> ballots = manager.findBallotCentres(town);
        return ballots;
    }
    
    @RequestMapping("/towns")
    @ResponseBody
    public List<Town> findTowns(){
        List<Town> towns = manager.findTowns();
        return towns;
    }    
}
